/**
 * 
 */
package com.zeba.buysell;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

import com.zeba.buysell.BuyActivityTransitionManager.BuyActivityMap;

/**
 * @author Zeba
 *
 */
public class BuyListener implements OnClickListener {

	private BuySellActivity activity;

	public void setCallerActivity(BuySellActivity activity){
		this.activity = activity;
	}
	
	
	
	public void onClick(View view) {
		
		boolean buySuccess = performBuyActivity(view);
		transitionToNextActivity(buySuccess);
		
	}

	private void transitionToNextActivity(boolean isBuySuccess) {
		Intent intent = null;
		if(isBuySuccess){
			intent = BuyActivityTransitionManager.getIntent(BuyActivityMap.SUCCESS,activity);
		}else{
			intent = BuyActivityTransitionManager.getIntent(BuyActivityMap.FAILURE,activity);
		}
		activity.startActivity(intent);
	}

	private boolean performBuyActivity(View view) {
		return true;
	}


}
